// @ts-ignore
function Vechile(brandNo, price) {
  // 父类
  console.log("this:", this);
  this.brandNo = brandNo; // 品牌
  this.price = price; // 价格
}

Vechile.prototype.sale = function () {
  console.log(this + "销售");
};
// @ts-ignore
// 寄生式组合继承
// 中间对象，子类指向中间对象
function protoExtendsWithMd1(ParentClass, SonClass) {
  function Middle() {
    // 等价于Bus.prototype.constructor = Bus;
    this.constructor = SonClass;
  }
  // 中间对象的__proto__指向父类的Prototype
  Middle.prototype = ParentClass.prototype;
  // 子类对象的__proto__指向中间对象
  SonClass.prototype = new Middle();
}

// 继承
// @ts-ignore
function Bus(brandNo, price, seatNo) {
  // 子类 构造函数继承
  Vechile.call(this, brandNo, price);
  this.seatNo = seatNo;
}

protoExtendsWithMd1(Vechile, Bus);
// @ts-ignore
let bus = new Bus("大巴", 20, 64);
console.log("🚀 ~ bus:", bus);
// @ts-ignore
bus.sale();

// export {};
